--- title: "逆行" created: 2025-11-28 tags: - 算法 --- # 逆行 ## 题目 [逆行](https://www.acwing.com/problem/content/5849/) ![[image-dc673c98.png]] ## 思路分析 ## 代码实现 ```cpp #include using namespace std; #define endl '\n' const int N=1000; int E=0,W=0; int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n;cin>>n; while(n--){ int x;cin>>x; if(x>0) E++; else W++; } cout<<(W>E?E:W)<